using IQIGame.Onigao.GamePlay;
using System.Collections.Generic;

namespace IQIGame.Onigao.Logic
{
    public partial class LevelRegion : IConditionPropFetcherContainer
    {
        public int FetchConditionProp(ConditionBlackboard blackboard, int iType, IReadOnlyList<int> curValueParams)
        {
            ConditionEnviromentPropType type = (ConditionEnviromentPropType)iType;
            switch (type)
            {
                case ConditionEnviromentPropType.LevelParams:
                    return level.GetLevelParam(curValueParams[0]);
                case ConditionEnviromentPropType.EntityExist:
                    return GetEntityByTagOrMcid(curValueParams[0]) != null ? 1 : 0;
                case ConditionEnviromentPropType.DayHour:
                    return level.curTimeHour;
                default:
                    LogicLog.LogError($"关卡逻辑层不支持的条件类型：1 - {iType}");
                    return 0;
            }
        }

        public IConditionPropFetcher GetPropFetcherById(int id)
        {
            return GetEntityByTagOrMcid(id);
        }
    }
}
